<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<fieldset id="contents">
			<legend>#contents</legend>
			<p>
				How about to read <a href="https://wikipedia.org">Wikipedia</a> or visit
				<a href="https://w3.org"><i>W3.org</i></a> and learn about modern standards?
			</p>
		</fieldset>

		<script>
			const contents = document.querySelector('#contents')

			contents.addEventListener('click', (event) => {
				const a = event.target.closest('a')

				if (a) {
					const isGo = confirm(' ' + a.href + ' ?')
					if (!isGo) event.preventDefault()
				}
			})

			// 阻止浏览器默认右键事件行为
			// document.addEventListener('contextmenu', (event) => {
			// 	event.preventDefault()
			// })
		</script>
	</body>
</html>
